home *** CD-ROM | disk | FTP | other *** search
- /*============================================================
-
- N_Font sample program
-
- ============================================================*/
-
- #include "N_Library.h"
-
- WindowPtr CreateWindow (Str255 name);
-
- #define WindowSizeX 640
- #define WindowSizeY 480
-
- short NewWindowX;
- short NewWindowY;
-
- short Data_Rsrc = 0;
-
- WindowPtr window;
-
-
- //counter
- long counter1 = 123456;
- long counter2 = 99999;
-
- short x = -100;
- short x2 = 640;
-
- void main(void)
- {
- ToolboxInit();
- ColorCheck();
- HideCursor();
- window = CreateWindow("\pN Game Library <Font Sample>");
- N_Window_Set(window,NewWindowX,NewWindowY,WindowSizeX,WindowSizeY); //set up window
- Open_Resource_File(128,1,&Data_Rsrc);
- N_Sp_Make(640,480); //set up for sprites
- N_Cel_Make(65536); //set up for cel
- N_Font_Init();
- N_Sprite_Set(129,0,14,24,1,11,1,0); //set sprites
- N_Sprite_Set(130,11,12,16,1,13,4,0);
-
- N_Font_Set(0,0,0,0x80000000,0); //set fonts
- N_Font_Set(1,0x80000000+11,0,0x80000000+26+11,0x80000000+37+11);
-
- N_Pict_Draw(128,0,0,(GrafPtr)SP_off,true); //draw background
- Close_Resource_File(&Data_Rsrc);
-
- do
- {
- N_Num_Put(counter1,x,80,8,16,0,1,0); //(x,80)ÅAspace16,8segments,fontset0,cel plane 0-
- N_Num_Put(counter2,x,138,8,14,1,1,24); //(x,160)ÅAspace14,8segments,fontset1,cel plane 24-
- N_Font_Put("\pN GAME LIBRARY SAMPLE PROGRAM!",x2,180,14,1,1,30);
- counter1++; //updates counters
- counter2-=64;
- if (counter1 >= 99999999) counter1 = 0;
- if (counter2 <= 0) counter2 = 99999;
-
- x = x+1; //move
- if (x >= 640) x=-100;
-
- x2-=2;
- if (x2 <= -500) x2=640;
-
-
- N_Cel_Loop(0,0);
- }
- while (!Button());
- ShowCursor();
- ColorRevert();
- }
-
-
- WindowPtr CreateWindow (Str255 name)
- {
- short centerX,centerY;
- short windowWidth,windowHeight;
-
- window = GetNewWindow (128,nil,(WindowPtr)-1L );
- centerX = (qd.screenBits.bounds.right -qd.screenBits.bounds.left)/2;
- centerY = (qd.screenBits.bounds.bottom -qd.screenBits.bounds.top)/2;
- SetWTitle(window,name);
- MoveWindow(window,NewWindowX=centerX-(WindowSizeX/2),NewWindowY=centerY-(WindowSizeY/2),false);
- SizeWindow(window,WindowSizeX,WindowSizeY,TRUE);
- ShowWindow(window);
- SetPort((GrafPtr)window );
- return (WindowPtr)window;
- }
-
-
-
-
-